﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ARchGL.Platform.WindowsService.Core
{
    public class ResultDto
    {
        //服务端返回数据结构
        //{"result":"这条信息来自华汇项目","targetUrl":null,"success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}

        public ResultDto() { }

        public ResultDto(string title)
        {
            Result = new LEDDto
            {
                Title = title,
                FontSize = 12
            };
        }

        public ResultDto(string title, int fontSize)
        {
            Result = new LEDDto
            {
                Title = title,
                FontSize = fontSize
            };
        }

        public LEDDto Result { set; get; }

        /// <summary>获取默认配置</summary>
        public ResultDto GetDefault()
        {
            return new ResultDto("数据请求中，请稍后。。。", 12);
        }
    }

    public class LEDDto
    {
        /// <summary>开关：0关，1开</summary>
        public int Switch { get; set; }

        /// <summary>标段名称</summary>
        public string Title { get; set; }

        private string content = string.Empty;
        /// <summary>显示内容</summary>
        public string Content
        {
            get
            {
                if (string.IsNullOrEmpty(content)) content = "未收到数据";
                return content;
            }
            set { content = value; }
        }

        private int fontSize = 12;
        /// <summary>文字大小：最小字号9，16高度最大13</summary>
        public int FontSize
        {
            get
            {
                return fontSize;
            }
            set { fontSize = value; }
        }

        /// <summary>
        /// 标题位置信息
        /// </summary>
        public RectangleDto TitleRectangle { get; set; }
        /// <summary>
        /// 内容位置信息
        /// </summary>
        public RectangleDto ContentRectangle { get; set; }
    }
}
